import java.util.Stack;

public class Topic_1_3MainTest {
    public static void main(String[] args) {
        Stack<Integer> stack=new Stack();
        stack.push(1);
        stack.push(2);
        stack.push(3);
        System.out.println("栈顶元素为："+stack.peek());
        while(!stack.empty()){
            if(stack.peek()%2==0){
                System.out.println(stack.pop());
            }
        }
    }

}
